/**
 * @Description
 * @author 20155870 杨润增
 * @create 2018-06-09 22:02
 **/
package com.campus_information_portal.controller;

import com.campus_information_portal.entity.Punish;
import com.campus_information_portal.service.PunishService;
import com.campus_information_portal.util.Message;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @className PunishController
 * @Description
 * @author
 * @create 2018-06-09 22:02
 **/
@Controller
@RequestMapping("/punish")
@ResponseBody
@CrossOrigin(origins = "*")
public class PunishController {
    @Autowired
    private PunishService punishService;

    @RequestMapping(value = "/queryAllPunish",method = RequestMethod.GET)
    public Message queryPunish(){
        return punishService.queryAllPunish();
    }

    @RequestMapping(value = "/queryMyPunish",method = RequestMethod.GET)
    public Message queryAPunish(@Param("stuNum") Integer stuNum){
        return punishService.queryPunishByStuNum(stuNum);
    }

    @RequestMapping(value = "/addPunish",method = RequestMethod.POST)
    public Message addPunish(@RequestBody Punish punish){
        return punishService.addPunish(punish);
    }

    @RequestMapping(value = "/deletePunish",method = RequestMethod.GET)
    public Message deletePunish(@Param("punishId") Integer punishId){
        return punishService.deletePunish(punishId);
    }


    @RequestMapping(value = "/updatePunish",method = RequestMethod.GET)
    public Message updatePunish(@Param("punishId") Integer punishId,@Param("punishType") String punishType){
        return punishService.editPunish(punishId,punishType);
    }

    @RequestMapping(value = "/updatePunishStatus",method = RequestMethod.GET)
    public Message updatePunish(@Param("punishId") Integer punishId,@Param("status") Integer status){
        return punishService.editPunishStatus(punishId,status);
    }


}
